package com.tubi.StringBuilder;

public class 拼接字符串 {
    public static void main(String[] args) {

        int[] arr = {1,2,3,4};
        String pinjie = pinjie(arr);
        System.out.println(pinjie);

    }
    public static String pinjie(int[] arr){
        StringBuilder sb = new StringBuilder("[");
        for (int i = 0; i < arr.length; i++) {
            if(i== arr.length-1){
                sb.append(arr[i]).append("]");
            }else {
                sb.append(arr[i]).append(",");
            }
        }

        String jg = sb.toString();
        return jg;
    }
}
